package com.bytezero.menu;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.widget.Button;

public class MainActivity2 extends AppCompatActivity {
    public static final String TAG = "MainActivity2";

    @Override
    public void onBackPressed() {
        super.onBackPressed();
        Intent intent = new Intent();
        intent.putExtra("Data","zhengleizhenglei");
        setResult(RESULT_OK,intent);
        finish();
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main2);

//        Intent intent = getIntent();
//        String data = intent.getStringExtra("name");
//        Log.e(TAG, "onCreate: "+data );
        Intent intent = getIntent();
        int age = intent.getIntExtra("age", 0);
        Log.e(TAG, "onCreate: " + age);


        Button back = (Button) findViewById(R.id.back);
        back.setOnClickListener(v -> {
            Intent intent1 = new Intent();
            intent1.putExtra("data","zhenglezhenglei");
            setResult(RESULT_OK,intent1);
            finish();

        });



    }


}